//pages/self-practise/practise.js
const common = require("../../../utils/zstz.js");
const app = getApp().globalData;

Page({
  /**
   * 页面的初始数据
   */
  data: {
    name: wx.getStorageSync('userInfo').nickName,
    avatar: wx.getStorageSync('userInfo').avatarUrl,
    score: '',
    qCataId: '',
    cataname: ''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      score: options.score,
      qCataId: options.qCataId,
      cataname: options.cataname,
      name: options.myName,
      avatar: options.myAvatar,

    })
  },

  bindBackFirst: function (event) {
    console.log('返回首页')
    wx.reLaunch({
      url: '/pages/zstz/zstzIndex/index'
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    let that = this;
    return {
      title: '线上竞答结果',
      path: '/pages/zstz/selfPractise/practise?myName=' + that.data.name + '&myAvatar=' + that.data.avatar + '&score=' + that.data.score + '&qCateId=' + that.data.qCataId + '&catename=' + that.data.cataname + '&fid=' + app.fid + '&fidEnc=' + app.fidEnc
    }
  },

  onShareTimeline: function (res) {
    let that = this;
    return {
      title: '线上竞答结果',
      query: 'myName=' + that.data.name + '&myAvatar=' + that.data.avatar + '&score=' + that.data.score + '&qCateId=' + that.data.qCataId + '&catename=' + that.data.cataname + '&fid=' + app.fid + '&fidEnc=' + app.fidEnc
    }
  },
  
})